from rest_framework import serializers
from home.models import AxfWheel,AxfNav,AxfMainshow,AxfShop,AxfMustbuy


class WheelSerializer(serializers.ModelSerializer): # 创建序列化类，用于将对象序列化为json格式。通过模型生成序列化器。还有继承serializers.Serializer的写法，不如这个方便。
    class Meta:
        model=AxfWheel # 序列化用到的模型，即要序列化的对象所属的模型
        fields='__all__' # 要序列化的字段，'__all__'表示所有字段


class NavSerializer(serializers.ModelSerializer):
    class Meta:
        model=AxfNav
        fields='__all__'


class MainShowSerializer(serializers.ModelSerializer):
    class Meta:
        model=AxfMainshow
        fields='__all__'


class ShopSerializer(serializers.ModelSerializer):
    class Meta:
        model=AxfShop
        fields='__all__'


class MustBuySerializer(serializers.ModelSerializer):
    class Meta:
        model=AxfMustbuy
        fields='__all__'